#ifndef NEWTASKWIDGET_H
#define NEWTASKWIDGET_H

#include <QtWidgets>
#include "localstoragewidget.h"
#include "ftpstoragewidget.h"
#include "backupengine.h"
#include "backuptask.h"

class MainWindow;

class NewTaskWidget : public QWidget
{
    Q_OBJECT
public:
    explicit NewTaskWidget(MainWindow *parent = 0);
    
private:
    LocalStorageWidget *localStorageWidget;
    FTPStorageWidget *ftpStorageWidget;

    MainWindow *parentWindow;

    //Layouts
    QVBoxLayout *centralLayout;
    QHBoxLayout *sourceLayout;

    //Groups
    QGroupBox *backupTypeGroup;
    QGridLayout *backupTypeLayout;

    QGroupBox *backupOptionsGroup;
    QGridLayout *backupOptionsLayout;

    QGroupBox *backupTargetGroup;
    QHBoxLayout *backupTargetLayout;

    //Widgets
    QLineEdit *sourceValue;

    QComboBox *backupTypeValue;

    QCheckBox *createArchive;
    QComboBox *compressionLevelValue;
    QLineEdit *passwordValue;

    QCheckBox *encryptBackup;

    QRadioButton *completeBackupButton;
    QRadioButton *incrementalBackupButton;
    QCheckBox *useHashes;
    QCheckBox *periodic;

    QRadioButton *manualBackupButton;
    QRadioButton *periodicalBackupButton;
    QComboBox *backupTargetValue;

    QSpinBox *periodHoursValue;
    QSpinBox *periodDaysValue;
    QDateTimeEdit *firstRunValue;

    QPushButton *sourceButton;
    QStackedWidget *backupTargets;
    QPushButton *startBackup;


    //Methods
    void createLayout();
    void createGroups();
    void createWidgets();
    void setDefaultSettings();
signals:
    void newTaskCreated();
    void activateTask(quint32 id);
private slots:
    void sourceButtonClicked();
    void startBackupClicked();
};

#endif // NEWTASKWIDGET_H
